package cn.hqisgood.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.hqisgood.bean.Department;
import cn.hqisgood.bean.Msg;
import cn.hqisgood.dao.DepartmentMapper;
import cn.hqisgood.service.DepartmentService;

@Controller
public class DepartmentController {
	@Autowired
	private DepartmentService departmentService;
	@RequestMapping("/depts")
	@ResponseBody
	public Msg getDepts() {
		List<Department> depts = departmentService.getDepts();
		return Msg.success().add("depts", depts);
		
	}
	
	@RequestMapping("/dept")
	@ResponseBody
	public Msg getDept(Integer id) {
		Department dept = departmentService.getDept(id);
		return Msg.success().add("dept", dept);
		
	}

}
